package com.xyb.entity.gitee;

import com.xyb.entity.GiteeUser;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class GiteeUserInfo {
    private long id;
    private String login;
    private String name;
    private String avatar_url;
    private String url;
    private String html_url;
    private String followers_url;
    private String following_url;
    private String gists_url;
    private String starred_url;
    private String subscriptions_url;
    private String organizations_url;
    private String repos_url;
    private String events_url;
    private String received_events_url;
    private String type;
    private String blog;
    private String weibo;
    private String bio;
    private int public_repos;
    private int public_gists;
    private int followers;
    private int following;
    private int stared;
    private int watched;
    private String created_at;
    private String updated_at;
    private String email;

    public static GiteeUser toGiteeUser(GiteeUserInfo info) {
        GiteeUser giteeUser = GiteeUser.builder()
                .id(info.getId())
                .login(info.getLogin())
                .name(info.getName())
                .avatarUrl(info.getAvatar_url())
                .url(info.getUrl())
                .htmlUrl(info.getHtml_url())
                .followersUrl(info.getFollowers_url())
                .followingUrl(info.getFollowing_url())
                .gistsUrl(info.getGists_url())
                .starredUrl(info.getStarred_url())
                .subscriptionsUrl(info.getSubscriptions_url())
                .organizationsUrl(info.getOrganizations_url())
                .reposUrl(info.getRepos_url())
                .eventsUrl(info.getEvents_url())
                .receivedEventsUrl(info.getReceived_events_url())
                .type(info.getType())
                .blog(info.getBlog())
                .weibo(info.getWeibo())
                .bio(info.getBio())
                .publicRepos(info.getPublic_repos())
                .publicGists(info.getPublic_gists())
                .followers(info.getFollowers())
                .following(info.getFollowing())
                .stared(info.getStared())
                .watched(info.getWatched())
                .createdAt(info.getCreated_at())
                .updatedAt(info.getUpdated_at())
                .email(info.getEmail())
                .build();
        return giteeUser;
    }
}
